package org.xukai.remoting.ws.defaultsoap;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;

/**
 * @author xukai
 * @desc
 * @date 2016-09-27-下午 6:19
 */
public class cxfTest {

    public static void main(String[] args) {

        JaxWsProxyFactoryBean fac = new JaxWsProxyFactoryBean();
        fac.setServiceClass(DefaultService.class);
//        fac.setAddress("http://127.0.0.1:8076/webServices2?groupName=test_20160927");
        fac.setAddress("http://localhost:8076/stdwsflow/getWsdlContent/test_20160927?wsdl");

        fac.getInInterceptors().add(new LoggingInInterceptor());
        fac.getOutInterceptors().add(new LoggingOutInterceptor());
        DefaultService sv = (DefaultService) fac.create();
//        String res = sv.demo("{'startDate':'20150615'}");
//        String res = sv.demo("<startDate>11</startDate>");
//        String res = sv.demo("<root><startDate>20160505</startDate></root>");
        String res = sv.demo(33);

        System.out.println(res);
    }
}
